package bean.lookup;

import org.springframework.beans.factory.annotation.Lookup;

/**
 *TODO
 * 设置了Lookup属性，Spring在创建car时，会调用mbdToUse.prepareMethodOverrides();
 * 将标记lookup和replace-method的对象，都使用CGLIB生成一个子类来进行代理。
 */
public abstract class Car {

	//用于lookup-method注入
	@Lookup
	public abstract Taxi createTaxi();

	@Lookup
	public abstract Taxi createTaxi(Object o);

	private Taxi taxi;

	public Taxi getTaxi() {
		return taxi;
	}

	//setter注入
	public void setTaxi(Taxi taxi) {
		this.taxi = taxi;
	}

	@Override
	public String toString() {
		return "Car{" +
				"taxi=" + taxi +
				'}';
	}
}

